﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RealtyManagementSystem.DAL;

namespace RealtyManagementSystem.BLL.Fees.POCO
{
    public class BillDetails
    {
        public BillDetails(List<FeeItem> items, decimal totalAmount, decimal totalReceived)
        {
            FeeItems = items;
            TotalAmount = totalAmount;
            TotalPaidUp = totalReceived;
        }

        public BillDetails()
        {
        }

        public List<FeeItem> FeeItems { get; set; }

        public decimal TotalAmount = 0.0M;
        public decimal TotalPaidUp = 0.0M;

        public override string ToString()
        {
            var items = string.Join(" \n ", (from fitem in FeeItems
                                             select fitem.Year + "年 \t\t需缴：" + fitem.Amount + "元 \t\t已缴：" + fitem.ReceivedAmount + "元 \t\t <br/>\n").ToArray());

            return items + "合计应缴：" + TotalAmount + "元 \t\t" + "合计实缴：" + TotalPaidUp + "元\n\n";
        }
    }
}